package com.qf.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestMapping;
import springfox.documentation.RequestHandler;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

//设置或配置类时使用此注解
@Configuration
@EnableSwagger2
public class SwaggerConfig {

    //把返回值加入到spring ioc容器
    @Bean
    public Docket docketConfig(){
        return new Docket(DocumentationType.SWAGGER_2).
                apiInfo(new ApiInfoBuilder().title("Api文档标题").
                        description("这个是文档的描述").
                        version("V1.0.0").
                        build()).
                        select()
                        .apis(RequestHandlerSelectors.any())
                        .paths(PathSelectors.any())
                        .build();
    }

}
